<?php
define('BASEDIR', './');
require BASEDIR . 'bin.php';

TrafficSessionManager::init();
$human = TrafficSessionManager::getPNJ($_REQUEST['id']);

?><script type="text/javascript">
	$(function(){
		$('.return_map,.deletelink').on('click', function(){
			if ($(this).attr('id') == 'delete_contact') {
				getq('deleteContact.php?id=<?php echo $_REQUEST['id']; ?>', function(data) {});
				updateContact();
			}
			updateMap();
		});
		$('.phonelinkcontact').on('click', function() {
			var a = $(this).attr('id');
			postq(
				($(this).hasClass('dealer_phone') ? 'getCallDealer.php' : 'getCallClient.php'),
				{id: a.substr(19), cs: '<?php echo TrafficDialog::HELLO; ?>', time: (game_current_time_stamp + initial_time_mytho)},
				function(data) {
					$('#box_center').html(data);
				}
			);
		});
	});
</script>
<h2 valign="top" style="vertical-align: top;"><img src="info.png" width="16" height="16" /> &nbsp;<?php echo utf8_encode($human->getFullName()); ?></h2>
<p style="font-size: 11px;"><?php echo utf8_encode($human->getGender()); ?>, <?php echo $human->age ?> ans, <?php echo $human->getType(); ?><br /><i style="font-size: 11px;text-align: justify; color: #777"><?php echo utf8_encode(ucfirst($human->background)); ?></i></p>
<!-- <p><?php echo utf8_encode($human->getTraits()); ?></p> -->
<table style="width: 100%;">
	<tr>
		<td style="width: 33%;">Relation</td>
		<td style="width: 33%;">Niveau</td>
		<td>Prix</td>
	</tr>
	<tr>
		<td><?php echo utf8_encode($human->getLoveText()); ?></td>
		<td><?php echo utf8_encode($human->getLevelText()); ?></td>
		<td><?php echo utf8_encode($human->getPriceText()); ?></td>
	</tr>
</table><br /><?php
	if ($human->getType() != 'dealer') {
		?>Produit favori: <?php echo utf8_encode(TrafficDrugUtils::$drugs[$human->favorite_drug]->name);
	} else {
		?>Produit vendu: <?php echo utf8_encode(TrafficDrugUtils::$drugs[$human->drug_type]->name);
	}
	?><br />
<div style="width:100%;">
	<br />
	<img src="phone.png" width="12" height="12" />&nbsp;
	<a href="javascript:;" id="contact_user_phone_<?php echo $human->id; ?>" class="cssphone phonelinkcontact<?php if ($human->getType() == 'dealer') echo ' dealer_phone'; ?>">
		Appeler (<?php echo $human->phone; ?>)
	</a>
	<br />
	<img src="images/recycle_bin.png" width="12" height="12" />&nbsp;
	<a href="javascript:;" class="deletelink" id="delete_contact">Supprimer le contact&nbsp;</a>
	<div style="text-align: center;"></div>
</div>
<p style="text-align: center;"><a href="javascript:;" class="return_map">Retour</a></p>